<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cppMISC: include/connection.hpp 源文件</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript" src="../../darkmode_toggle.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">cppMISC<span id="projectnumber">&#160;v1.1</span>
   </div>
   <div id="projectbrief">cppMisc 文档系统</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('../../',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">connection.hpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../dd/d42/connection_8hpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="preprocessor">#include &lt;memory&gt;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span><span class="preprocessor">#include &lt;atomic&gt;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno">   14</span> </div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span><span class="preprocessor">#include &quot;uv.h&quot;</span></div>
<div class="foldopen" id="foldopen00016" data-start="{" data-end="};">
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html">   16</a></span><span class="keyword">class </span><a class="code hl_class" href="../../d5/dca/classtcp_connect.html">tcpConnect</a></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span>{</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span><span class="keyword">public</span>:</div>
<div class="foldopen" id="foldopen00019" data-start="{" data-end="};">
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76a">   19</a></span>    <span class="keyword">enum</span> <a class="code hl_enumeration" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76a">emErrCode</a>{</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa3a3d8ecfabf8e65f67095fe518e3907d">   20</a></span>        <a class="code hl_enumvalue" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa3a3d8ecfabf8e65f67095fe518e3907d">ERR_ALLOC_MEM</a> = -1000,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aaa986cb21c90c7464a5bd3a609cff4339">   21</a></span>        <a class="code hl_enumvalue" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aaa986cb21c90c7464a5bd3a609cff4339">ERR_INIT_SOCKET</a>,</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa7f9390b5aca539bce9e01c38fa8a8c58">   22</a></span>        <a class="code hl_enumvalue" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa7f9390b5aca539bce9e01c38fa8a8c58">ERR_SOCKET</a>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa21d5ae99cd043725442707213189005d">   23</a></span>        <a class="code hl_enumvalue" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa21d5ae99cd043725442707213189005d">ERR_SEND_DATA</a>,</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aae5994f3020584a57e2a639e634c1dcbd">   24</a></span>        <a class="code hl_enumvalue" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aae5994f3020584a57e2a639e634c1dcbd">ERR_TCP_NULL</a>,</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span>        <a class="code hl_enumvalue" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa2a24542e567f8fe800702fe981a1daf6">OK</a> = 0</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa2a24542e567f8fe800702fe981a1daf6">   26</a></span>    };</div>
</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno">   27</span> </div>
<div class="foldopen" id="foldopen00028" data-start="{" data-end="};">
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"><a class="line" href="../../de/d3a/structtcp_connect_1_1st_send_req.html">   28</a></span>    <span class="keyword">struct </span><a class="code hl_struct" href="../../de/d3a/structtcp_connect_1_1st_send_req.html">stSendReq</a>{</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="../../de/d3a/structtcp_connect_1_1st_send_req.html#a9f96557248e4d12b4e693c918a6ad3f7">   29</a></span>        uv_write_t   <a class="code hl_variable" href="../../de/d3a/structtcp_connect_1_1st_send_req.html#a9f96557248e4d12b4e693c918a6ad3f7">req</a>;</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="../../de/d3a/structtcp_connect_1_1st_send_req.html#a2bc178ebb63281ebef22f02237fa6caa">   30</a></span>        uv_buf_t     <a class="code hl_variable" href="../../de/d3a/structtcp_connect_1_1st_send_req.html#a2bc178ebb63281ebef22f02237fa6caa">data</a>;</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"><a class="line" href="../../de/d3a/structtcp_connect_1_1st_send_req.html#afcb8f0b2611b2c706b29d94e15e70aa4">   31</a></span>        <a class="code hl_class" href="../../d5/dca/classtcp_connect.html">tcpConnect</a> * <a class="code hl_variable" href="../../de/d3a/structtcp_connect_1_1st_send_req.html#afcb8f0b2611b2c706b29d94e15e70aa4">obj</a>;</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span> </div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"><a class="line" href="../../de/d3a/structtcp_connect_1_1st_send_req.html#a5d1e91059831ffc53ec78ee22990cc0e">   33</a></span>        <a class="code hl_function" href="../../de/d3a/structtcp_connect_1_1st_send_req.html#a5d1e91059831ffc53ec78ee22990cc0e">stSendReq</a>():<a class="code hl_variable" href="../../de/d3a/structtcp_connect_1_1st_send_req.html#afcb8f0b2611b2c706b29d94e15e70aa4">obj</a>( nullptr ){}</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span>    };</div>
</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span><span class="keyword">private</span>:</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span>    std::string                     m_name;</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span>    std::string                     __m_peer_ip;</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span>    <span class="keywordtype">int</span>                             __m_peer_port;</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span>    uv_tcp_t                      * __p_tcp;</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span>    std::shared_ptr&lt; char &gt;         p_buff;</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span>    std::atomic&lt; bool &gt;             __m_is_stop;</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span> </div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span>    std::function&lt; void ( <span class="keyword">const</span> std::string&amp; , <span class="keyword">const</span> <span class="keywordtype">char</span> * , <span class="keywordtype">size_t</span> ) &gt;    __cb_on_data;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>    std::function&lt; void ( <span class="keyword">const</span> std::string&amp; ) &gt;                __cb_disconnected;</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>    std::function&lt; void ( <span class="keyword">const</span> std::string&amp; , <a class="code hl_enumeration" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76a">emErrCode</a> ) &gt;        __cb_error;</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span>    <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a1c6a3ae19041221780401c703827d794">tcpConnect</a>( uv_tcp_t *tcp = <span class="keyword">nullptr</span> );</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span>        <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#abe3affb5242552ca4a4f18a9d8d93853">~tcpConnect</a>();</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a62b839c5c632070457c11141ec17b940">onAllocMem</a>( uv_buf_t * buf );</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a6a44f7ed0e8e6c5026f69eb93b9484db">start</a>();</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span>        <span class="keyword">static</span> std::string <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#aacaae6d523ad0440eb5d30c8ff07b3e8">errMsg</a>( <a class="code hl_enumeration" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76a">emErrCode</a> );</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#abc6cec650922874b8ca82221fe8e987b">   65</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#abc6cec650922874b8ca82221fe8e987b">name</a>( <span class="keyword">const</span> std::string&amp; n ){ m_name = n; }</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#a3db9cc5be0a25212c5cf1f7d3c0a229f">   66</a></span>        <span class="keyword">const</span> std::string&amp; <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a3db9cc5be0a25212c5cf1f7d3c0a229f">name</a>()<span class="keyword"> const</span>{ <span class="keywordflow">return</span> m_name; }</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a3e573d0bbcfd9a2c0e7f10f37d84fa46">send</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> * data , <span class="keywordtype">size_t</span> len );</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span>    std::string <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a0e47a364f3a6980332e35589eb4b8690">peerAddress</a>();</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span>    <span class="keywordtype">int</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a1ad930fd567805e8bdb83b2189ff5c48">peerPort</a>();</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#ace0b548a07940bc95005fd84d1d4917f">close</a>();</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#a773c8544725f30fdc63afaf934f6aefd">   88</a></span>    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a773c8544725f30fdc63afaf934f6aefd">onRecv</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keyword">const</span> std::string&amp; , <span class="keyword">const</span> <span class="keywordtype">char</span> * , <span class="keywordtype">size_t</span> len )&gt; fun ){ __cb_on_data = fun; }</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#ac906dea41da72e91452818a0bd8383aa">   89</a></span>    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#ac906dea41da72e91452818a0bd8383aa">onDisconnected</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keyword">const</span> std::string&amp; ) &gt; fun ){ __cb_disconnected = fun; }</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"><a class="line" href="../../d5/dca/classtcp_connect.html#a07bd0d4dc7717401320314fa817996c2">   90</a></span>    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a07bd0d4dc7717401320314fa817996c2">onError</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keyword">const</span> std::string&amp; , <a class="code hl_enumeration" href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76a">emErrCode</a> ) &gt; fun){ __cb_error = fun; }</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a14f3ada6e1c24b0a973696f586badb63">onData</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> * data , ssize_t len );</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a39a9e6922fd51d19c7d422e1f41d86bb">onClosed</a>();</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno">  102</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="../../d5/dca/classtcp_connect.html#a22c40023d8cbc2258ae0003f2a1de7f3">onSendFail</a>();</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno">  103</span><span class="keyword">private</span>:</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno">  107</span>    <span class="keywordtype">bool</span> __init();</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno">  108</span>};</div>
</div>
<div class="ttc" id="aclasstcp_connect_html"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html">tcpConnect</a></div><div class="ttdoc">使用libuv实现的 TCP 客户链接管理模块</div><div class="ttdef"><b>定义</b> <a href="#l00016">connection.hpp:17</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a07bd0d4dc7717401320314fa817996c2"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a07bd0d4dc7717401320314fa817996c2">tcpConnect::onError</a></div><div class="ttdeci">void onError(std::function&lt; void(const std::string &amp;, emErrCode) &gt; fun)</div><div class="ttdef"><b>定义</b> <a href="#l00090">connection.hpp:90</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a0e47a364f3a6980332e35589eb4b8690"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a0e47a364f3a6980332e35589eb4b8690">tcpConnect::peerAddress</a></div><div class="ttdeci">std::string peerAddress()</div><div class="ttdoc">获取对端对峙</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00154">connection.cpp:154</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a14f3ada6e1c24b0a973696f586badb63"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a14f3ada6e1c24b0a973696f586badb63">tcpConnect::onData</a></div><div class="ttdeci">void onData(const char *data, ssize_t len)</div><div class="ttdoc">处理接受数据</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00079">connection.cpp:79</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a1ad930fd567805e8bdb83b2189ff5c48"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a1ad930fd567805e8bdb83b2189ff5c48">tcpConnect::peerPort</a></div><div class="ttdeci">int peerPort()</div><div class="ttdoc">获取对端端口</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00167">connection.cpp:167</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a1c6a3ae19041221780401c703827d794"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a1c6a3ae19041221780401c703827d794">tcpConnect::tcpConnect</a></div><div class="ttdeci">tcpConnect(uv_tcp_t *tcp=nullptr)</div><div class="ttdoc">以上是C语言的回调函数，用于和libuv对接</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00057">connection.cpp:57</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a22c40023d8cbc2258ae0003f2a1de7f3"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a22c40023d8cbc2258ae0003f2a1de7f3">tcpConnect::onSendFail</a></div><div class="ttdeci">void onSendFail()</div><div class="ttdoc">发送失败的回调函数</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00092">connection.cpp:92</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a39a9e6922fd51d19c7d422e1f41d86bb"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a39a9e6922fd51d19c7d422e1f41d86bb">tcpConnect::onClosed</a></div><div class="ttdeci">void onClosed()</div><div class="ttdoc">关闭</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00172">connection.cpp:172</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a3db9cc5be0a25212c5cf1f7d3c0a229f"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a3db9cc5be0a25212c5cf1f7d3c0a229f">tcpConnect::name</a></div><div class="ttdeci">const std::string &amp; name() const</div><div class="ttdef"><b>定义</b> <a href="#l00066">connection.hpp:66</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a3e573d0bbcfd9a2c0e7f10f37d84fa46"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a3e573d0bbcfd9a2c0e7f10f37d84fa46">tcpConnect::send</a></div><div class="ttdeci">void send(const char *data, size_t len)</div><div class="ttdoc">发送数据</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00205">connection.cpp:205</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a4d03abd4b5fcdddd1824fa62d7e1d76a"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76a">tcpConnect::emErrCode</a></div><div class="ttdeci">emErrCode</div><div class="ttdef"><b>定义</b> <a href="#l00019">connection.hpp:19</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a4d03abd4b5fcdddd1824fa62d7e1d76aa21d5ae99cd043725442707213189005d"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa21d5ae99cd043725442707213189005d">tcpConnect::ERR_SEND_DATA</a></div><div class="ttdeci">@ ERR_SEND_DATA</div><div class="ttdef"><b>定义</b> <a href="#l00023">connection.hpp:23</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a4d03abd4b5fcdddd1824fa62d7e1d76aa2a24542e567f8fe800702fe981a1daf6"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa2a24542e567f8fe800702fe981a1daf6">tcpConnect::OK</a></div><div class="ttdeci">@ OK</div><div class="ttdef"><b>定义</b> <a href="#l00026">connection.hpp:25</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a4d03abd4b5fcdddd1824fa62d7e1d76aa3a3d8ecfabf8e65f67095fe518e3907d"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa3a3d8ecfabf8e65f67095fe518e3907d">tcpConnect::ERR_ALLOC_MEM</a></div><div class="ttdeci">@ ERR_ALLOC_MEM</div><div class="ttdef"><b>定义</b> <a href="#l00020">connection.hpp:20</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a4d03abd4b5fcdddd1824fa62d7e1d76aa7f9390b5aca539bce9e01c38fa8a8c58"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aa7f9390b5aca539bce9e01c38fa8a8c58">tcpConnect::ERR_SOCKET</a></div><div class="ttdeci">@ ERR_SOCKET</div><div class="ttdef"><b>定义</b> <a href="#l00022">connection.hpp:22</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a4d03abd4b5fcdddd1824fa62d7e1d76aaa986cb21c90c7464a5bd3a609cff4339"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aaa986cb21c90c7464a5bd3a609cff4339">tcpConnect::ERR_INIT_SOCKET</a></div><div class="ttdeci">@ ERR_INIT_SOCKET</div><div class="ttdef"><b>定义</b> <a href="#l00021">connection.hpp:21</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a4d03abd4b5fcdddd1824fa62d7e1d76aae5994f3020584a57e2a639e634c1dcbd"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a4d03abd4b5fcdddd1824fa62d7e1d76aae5994f3020584a57e2a639e634c1dcbd">tcpConnect::ERR_TCP_NULL</a></div><div class="ttdeci">@ ERR_TCP_NULL</div><div class="ttdef"><b>定义</b> <a href="#l00024">connection.hpp:24</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a62b839c5c632070457c11141ec17b940"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a62b839c5c632070457c11141ec17b940">tcpConnect::onAllocMem</a></div><div class="ttdeci">void onAllocMem(uv_buf_t *buf)</div><div class="ttdoc">响应内存分配请求</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00101">connection.cpp:101</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a6a44f7ed0e8e6c5026f69eb93b9484db"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a6a44f7ed0e8e6c5026f69eb93b9484db">tcpConnect::start</a></div><div class="ttdeci">void start()</div><div class="ttdoc">启动执行</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00145">connection.cpp:145</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_a773c8544725f30fdc63afaf934f6aefd"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#a773c8544725f30fdc63afaf934f6aefd">tcpConnect::onRecv</a></div><div class="ttdeci">void onRecv(std::function&lt; void(const std::string &amp;, const char *, size_t len)&gt; fun)</div><div class="ttdoc">设置事件回调函数</div><div class="ttdef"><b>定义</b> <a href="#l00088">connection.hpp:88</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_aacaae6d523ad0440eb5d30c8ff07b3e8"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#aacaae6d523ad0440eb5d30c8ff07b3e8">tcpConnect::errMsg</a></div><div class="ttdeci">static std::string errMsg(emErrCode)</div><div class="ttdoc">读取错误消息</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00181">connection.cpp:181</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_abc6cec650922874b8ca82221fe8e987b"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#abc6cec650922874b8ca82221fe8e987b">tcpConnect::name</a></div><div class="ttdeci">void name(const std::string &amp;n)</div><div class="ttdoc">指定连接名称或者读取连接名称</div><div class="ttdef"><b>定义</b> <a href="#l00065">connection.hpp:65</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_abe3affb5242552ca4a4f18a9d8d93853"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#abe3affb5242552ca4a4f18a9d8d93853">tcpConnect::~tcpConnect</a></div><div class="ttdeci">~tcpConnect()</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00071">connection.cpp:71</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_ac906dea41da72e91452818a0bd8383aa"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#ac906dea41da72e91452818a0bd8383aa">tcpConnect::onDisconnected</a></div><div class="ttdeci">void onDisconnected(std::function&lt; void(const std::string &amp;) &gt; fun)</div><div class="ttdef"><b>定义</b> <a href="#l00089">connection.hpp:89</a></div></div>
<div class="ttc" id="aclasstcp_connect_html_ace0b548a07940bc95005fd84d1d4917f"><div class="ttname"><a href="../../d5/dca/classtcp_connect.html#ace0b548a07940bc95005fd84d1d4917f">tcpConnect::close</a></div><div class="ttdeci">void close()</div><div class="ttdoc">关闭连接</div><div class="ttdef"><b>定义</b> <a href="../../df/db6/connection_8cpp_source.html#l00159">connection.cpp:159</a></div></div>
<div class="ttc" id="astructtcp_connect_1_1st_send_req_html"><div class="ttname"><a href="../../de/d3a/structtcp_connect_1_1st_send_req.html">tcpConnect::stSendReq</a></div><div class="ttdef"><b>定义</b> <a href="#l00028">connection.hpp:28</a></div></div>
<div class="ttc" id="astructtcp_connect_1_1st_send_req_html_a2bc178ebb63281ebef22f02237fa6caa"><div class="ttname"><a href="../../de/d3a/structtcp_connect_1_1st_send_req.html#a2bc178ebb63281ebef22f02237fa6caa">tcpConnect::stSendReq::data</a></div><div class="ttdeci">uv_buf_t data</div><div class="ttdef"><b>定义</b> <a href="#l00030">connection.hpp:30</a></div></div>
<div class="ttc" id="astructtcp_connect_1_1st_send_req_html_a5d1e91059831ffc53ec78ee22990cc0e"><div class="ttname"><a href="../../de/d3a/structtcp_connect_1_1st_send_req.html#a5d1e91059831ffc53ec78ee22990cc0e">tcpConnect::stSendReq::stSendReq</a></div><div class="ttdeci">stSendReq()</div><div class="ttdef"><b>定义</b> <a href="#l00033">connection.hpp:33</a></div></div>
<div class="ttc" id="astructtcp_connect_1_1st_send_req_html_a9f96557248e4d12b4e693c918a6ad3f7"><div class="ttname"><a href="../../de/d3a/structtcp_connect_1_1st_send_req.html#a9f96557248e4d12b4e693c918a6ad3f7">tcpConnect::stSendReq::req</a></div><div class="ttdeci">uv_write_t req</div><div class="ttdef"><b>定义</b> <a href="#l00029">connection.hpp:29</a></div></div>
<div class="ttc" id="astructtcp_connect_1_1st_send_req_html_afcb8f0b2611b2c706b29d94e15e70aa4"><div class="ttname"><a href="../../de/d3a/structtcp_connect_1_1st_send_req.html#afcb8f0b2611b2c706b29d94e15e70aa4">tcpConnect::stSendReq::obj</a></div><div class="ttdeci">tcpConnect * obj</div><div class="ttdef"><b>定义</b> <a href="#l00031">connection.hpp:31</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.11.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
